<template>
  <div class="content">
    <van-nav-bar title="设置" left-text="返回" left-arrow @click-left="onClickLeft" />
    <div class="top">
      <van-cell-group inset>
        <van-cell title="个人信息" icon="shield-o" is-link to="/personal" />
        <van-cell title="关于我们" icon="setting-o" is-link to="/about" />
      </van-cell-group>
    </div>
    <div class="btn">
      <van-button type="primary" block @click="quit">退出登录</van-button>
    </div>
  </div>
</template>

<script lang="ts">
import { ref } from 'vue'
import { useRouter } from 'vue-router'
import { useStore } from 'vuex'
export default {
  name: '',
  props: [],
  setup(props, context) {
    const onClickLeft = () => history.back();
    const quit = () => {
      localStorage.removeItem('userInfo')
       let shopInfo = {
        s_name: ''
      }
      store.commit('shopercart/saveshopInfo', shopInfo)
      store.commit('shopercart/savesiderbarList', null)
      setTimeout(() => {
        goto()
      }, 1000);
    }
    const router = useRouter();
    const store = useStore()
    function goto() {
      router.push('/user')
    }
    return {
      onClickLeft,
      quit
    };
  },
}
</script>

<style scoped lang="scss">
.content {
  height: 100vh;
  background-color: rgb(240, 236, 236);

  .top {
    width: 23rem;
    position: relative;
    top: 0.6rem;
    margin: 0 auto;
  }

  .btn {
    position: relative;
    top: 2rem;
  }
}
</style>